import { Module } from '@nestjs/common';
import { TypeOrmModule } from '@nestjs/typeorm';
import { options } from './config/mysql.config';
import { UserModule } from './modules/user/user.module';
import { TransformInterceptor } from './common/interceptor/transform.interceptor';
import { APP_INTERCEPTOR, APP_FILTER } from '@nestjs/core';
import { HttpExceptionFilter } from './common/filter/http-exception.filter';

const TypeOrm = TypeOrmModule.forRoot(options);

@Module({
  imports: [TypeOrm, UserModule],
  providers: [
    {
      provide: APP_FILTER,
      useClass: HttpExceptionFilter,
    },
    {
      provide: APP_INTERCEPTOR,
      useClass: TransformInterceptor,
    },
  ],
  controllers: [],
})
export class AppModule {}
